package org.mx.hanlp.config;

import org.mx.hanlp.factory.SuggesterConfigBean;
import org.mx.hanlp.factory.SuggesterFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

/**
 * 描述： 推荐服务Java Config类
 *
 * @author John.Peng Date time 2018/4/20 上午8:44
 */
public class SuggesterConfig {
	/**
	 * 创建推荐服务器配置对象
	 * 
	 * @param env Spring环境
	 * @return 配置对象
	 */
	@Bean
	public SuggesterConfigBean suggesterConfigBean(Environment env) {
		return new SuggesterConfigBean(env);
	}

	/**
	 * 创建推荐服务器工厂
	 * 
	 * @param suggesterConfigBean 服务器配置对象
	 * @return 推荐器工厂
	 */
	@Bean(name = "suggesterFactory", initMethod = "init", destroyMethod = "destroy")
	public SuggesterFactory suggesterFactory(SuggesterConfigBean suggesterConfigBean) {
		return new SuggesterFactory(suggesterConfigBean);
	}
}
